import java.io.*;
import java.net.URI;
import java.awt.* ;

public class TestMember {

  static FileWriter fout = null;

  public static void main (String args[] ) {
      try {
	fout = new FileWriter( "member.html" );
	Member m = null;
	fout.write( "<HTML><HEAD><title>Members List</title></HEAD><center><TABLE>");
	for (int i = 0; i < 20; i ++) {
	     m = getMember() ;
	     fout.write( m.toTableRow() ) ;
	 }
	fout.write( "</<TABLE></center></HTML>");
	fout.close();
	launchBrowser( "member.html" );
      } catch (IOException e) { e.printStackTrace() ; }

  }

  static void launchBrowser( String fileName ) {
     try {
	if (Desktop.isDesktopSupported() ) {
	    File file = new File( fileName );
	     URI uri = file.toURI();
	    Desktop.getDesktop().browse(uri);
        }
     } catch (IOException e) { e.printStackTrace() ; } 
  }

  static Member getMember( ) {

     int k =  Member.rdm.nextInt ( 2 ) ;
     switch ( k ) {
        case 0 :	return new Member( );
        case 1 :	return new Student( ) ;
     }
     return null;
   }  
}
